home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / mappy.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  38KB  |  989 lines

  1. /***************************************************************************
  2.  
  3. Mappy memory map (preliminary)
  4.  
  5. driver by Aaron Giles
  6.  
  7.  
  8. CPU #1:
  9. 0000-07ff video RAM
  10. 0800-0fff color RAM
  11. 1000-177f RAM
  12. 1780-17ff sprite data 1 (sprite number & color)
  13. 1800-1f7f RAM
  14. 1f80-1fff sprite data 2 (x, y position)
  15. 2000-277f RAM
  16. 2780-27ff sprite data 3 (high bit of y, flip flags, double-size flags)
  17. 3800-3fff scroll register map
  18. 4040-43ff RAM shared with CPU #2
  19. 4800-480f custom I/O chip #1
  20. 4810-481f custom I/O chip #2
  21. 5002-5003 IRQ enable
  22. 5004-5005 cocktail flipscreen
  23. 5008      CPU #2 reset & disable I/O chips
  24. 5009      enable I/O chips
  25. 500a-500b CPU #2 enable
  26. 8000      watchdog timer
  27. a000-ffff ROM
  28.  
  29. CPU #2:
  30. 0000-0040 sound registers
  31. 0040-03ff RAM shared with CPU #1
  32. 2000-2001 IRQ enable
  33. 2006-2007 sound enable
  34. e000-ffff ROM
  35.  
  36. Interrupts:
  37. CPU #1 IRQ generated by VBLANK
  38. CPU #2 IRQ generated by VBLANK
  39.  
  40. Changes:
  41. Aug 1999   Proper cocktail emulation implemented by Chad Hendrickson
  42.  
  43. ***************************************************************************/
  44.  
  45. #include "driver.h"
  46. #include "vidhrdw/generic.h"
  47.  
  48.  
  49.  
  50. /* machine driver data & functions */
  51. extern unsigned char *mappy_sharedram;
  52. extern unsigned char *mappy_customio_1,*mappy_customio_2;
  53. void mappy_init_machine(void);
  54. void motos_init_machine(void);
  55. READ_HANDLER( mappy_sharedram_r );
  56. WRITE_HANDLER( mappy_sharedram_w );
  57. WRITE_HANDLER( mappy_customio_1_w );
  58. WRITE_HANDLER( mappy_customio_2_w );
  59. int mappy_interrupt_1(void);
  60. int mappy_interrupt_2(void);
  61. WRITE_HANDLER( mappy_interrupt_enable_1_w );
  62. WRITE_HANDLER( mappy_interrupt_enable_2_w );
  63. WRITE_HANDLER( mappy_cpu_enable_w );
  64. WRITE_HANDLER( mappy_reset_2_w );
  65. WRITE_HANDLER( mappy_io_chips_enable_w );
  66. WRITE_HANDLER( mappy_flipscreen_w );
  67.  
  68. READ_HANDLER( mappy_customio_1_r );
  69. READ_HANDLER( mappy_customio_2_r );
  70.  
  71. READ_HANDLER( digdug2_customio_1_r );
  72. READ_HANDLER( digdug2_customio_2_r );
  73.  
  74. READ_HANDLER( motos_customio_1_r );
  75. READ_HANDLER( motos_customio_2_r );
  76.  
  77. READ_HANDLER( todruaga_customio_1_r );
  78. READ_HANDLER( todruaga_customio_2_r );
  79.  
  80. /* video driver data & functions */
  81. int mappy_vh_start(void);
  82. int motos_vh_start(void);
  83. int todruaga_vh_start(void);
  84. void mappy_vh_stop(void);
  85. void mappy_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  86. WRITE_HANDLER( mappy_videoram_w );
  87. WRITE_HANDLER( mappy_colorram_w );
  88. WRITE_HANDLER( mappy_scroll_w );
  89. void mappy_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  90.  
  91. /* sound driver data & functions */
  92. extern unsigned char *mappy_soundregs;
  93. WRITE_HANDLER( mappy_sound_w );
  94. WRITE_HANDLER( mappy_sound_enable_w );
  95.  
  96.  
  97. /* CPU 1 read addresses */
  98. static struct MemoryReadAddress mappy_readmem_cpu1[] =
  99. {
  100.     { 0x4040, 0x43ff, MRA_RAM },            /* shared RAM with the sound CPU */
  101.     { 0x4800, 0x480f, mappy_customio_1_r },    /* custom I/O chip #1 interface */
  102.     { 0x4810, 0x481f, mappy_customio_2_r },    /* custom I/O chip #2 interface */
  103.     { 0x0000, 0x9fff, MRA_RAM },            /* RAM everywhere else */
  104.     { 0xa000, 0xffff, MRA_ROM },            /* ROM code */
  105.     { -1 }  /* end of table */
  106. };
  107.  
  108. static struct MemoryReadAddress digdug2_readmem_cpu1[] =
  109. {
  110.     { 0x4040, 0x43ff, MRA_RAM },                /* shared RAM with the sound CPU */
  111.     { 0x4800, 0x480f, digdug2_customio_1_r },    /* custom I/O chip #1 interface */
  112.     { 0x4810, 0x481f, digdug2_customio_2_r },    /* custom I/O chip #2 interface */
  113.     { 0x4820, 0x4bff, MRA_RAM },                /* extra RAM for Dig Dug 2 */
  114.     { 0x0000, 0x7fff, MRA_RAM },                /* RAM everywhere else */
  115.     { 0x8000, 0xffff, MRA_ROM },                /* ROM code */
  116.     { -1 }  /* end of table */
  117. };
  118.  
  119. static struct MemoryReadAddress motos_readmem_cpu1[] =
  120. {
  121.     { 0x4040, 0x43ff, MRA_RAM },            /* shared RAM with the sound CPU */
  122.     { 0x4800, 0x480f, motos_customio_1_r },    /* custom I/O chip #1 interface */
  123.     { 0x4810, 0x481f, motos_customio_2_r },    /* custom I/O chip #2 interface */
  124.     { 0x0000, 0x7fff, MRA_RAM },            /* RAM everywhere else */
  125.     { 0x8000, 0xffff, MRA_ROM },            /* ROM code */
  126.     { -1 }  /* end of table */
  127. };
  128.  
  129. static struct MemoryReadAddress todruaga_readmem_cpu1[] =
  130. {
  131.     { 0x4040, 0x43ff, MRA_RAM },                /* shared RAM with the sound CPU */
  132.     { 0x4800, 0x480f, todruaga_customio_1_r },    /* custom I/O chip #1 interface */
  133.     { 0x4810, 0x481f, todruaga_customio_2_r },    /* custom I/O chip #2 interface */
  134.     { 0x0000, 0x7fff, MRA_RAM },                /* RAM everywhere else */
  135.     { 0x8000, 0xffff, MRA_ROM },                /* ROM code */
  136.     { -1 }  /* end of table */
  137. };
  138.  
  139.  
  140. /* CPU 1 write addresses */
  141. static struct MemoryWriteAddress writemem_cpu1[] =
  142. {
  143.     { 0x1000, 0x177f, MWA_RAM },                                 /* general RAM, area 1 */
  144.     { 0x1800, 0x1f7f, MWA_RAM },                                 /* general RAM, area 2 */
  145.     { 0x2000, 0x277f, MWA_RAM },                                 /* general RAM, area 3 */
  146.     { 0x4040, 0x43ff, MWA_RAM, &mappy_sharedram },               /* shared RAM with the sound CPU */
  147.     { 0x4820, 0x4bff, MWA_RAM },                                 /* extra RAM for Dig Dug 2 */
  148.     { 0x0000, 0x07ff, mappy_videoram_w, &videoram, &videoram_size },/* video RAM */
  149.     { 0x0800, 0x0fff, mappy_colorram_w, &colorram },             /* color RAM */
  150.     { 0x1780, 0x17ff, MWA_RAM, &spriteram, &spriteram_size },    /* sprite RAM, area 1 */
  151.     { 0x1f80, 0x1fff, MWA_RAM, &spriteram_2 },                   /* sprite RAM, area 2 */
  152.     { 0x2780, 0x27ff, MWA_RAM, &spriteram_3 },                   /* sprite RAM, area 3 */
  153.     { 0x3800, 0x3fff, mappy_scroll_w },                          /* scroll registers */
  154.     { 0x4800, 0x480f, mappy_customio_1_w, &mappy_customio_1 },   /* custom I/O chip #1 interface */
  155.     { 0x4810, 0x481f, mappy_customio_2_w, &mappy_customio_2 },   /* custom I/O chip #2 interface */
  156.     { 0x5002, 0x5003, mappy_interrupt_enable_1_w },              /* interrupt enable */
  157.     { 0x5004, 0x5005, mappy_flipscreen_w },                 /* cocktail flipscreen */
  158.     { 0x5008, 0x5008, mappy_reset_2_w },                   /* reset CPU #2 & disable I/O chips */
  159.     { 0x5009, 0x5009, mappy_io_chips_enable_w },               /* enable I/O chips */
  160.     { 0x500a, 0x500b, mappy_cpu_enable_w },                      /* sound CPU enable */
  161.     { 0x8000, 0x8000, MWA_NOP },                                 /* watchdog timer */
  162.     { 0x8000, 0xffff, MWA_ROM },                                 /* ROM code */
  163.  
  164.     { -1 }  /* end of table */
  165. };
  166.  
  167.  
  168. /* CPU 2 read addresses */
  169. static struct MemoryReadAddress mappy_readmem_cpu2[] =
  170. {
  171.     { 0xe000, 0xffff, MRA_ROM },                                 /* ROM code */
  172.     { 0x0040, 0x03ff, mappy_sharedram_r },                      /* shared RAM with the main CPU */
  173.  
  174.     { -1 }  /* end of table */
  175. };
  176.  
  177. static struct MemoryReadAddress digdug2_readmem_cpu2[] =
  178. {
  179.     { 0xe000, 0xffff, MRA_ROM },                                 /* ROM code */
  180.     { 0x0040, 0x03ff, mappy_sharedram_r },                    /* shared RAM with the main CPU */
  181.  
  182.     { -1 }  /* end of table */
  183. };
  184.  
  185. static struct MemoryReadAddress motos_readmem_cpu2[] =
  186. {
  187.     { 0xe000, 0xffff, MRA_ROM },                                 /* ROM code */
  188.     { 0x0040, 0x03ff, mappy_sharedram_r },                         /* shared RAM with the main CPU */
  189.  
  190.     { -1 }  /* end of table */
  191. };
  192.  
  193. static struct MemoryReadAddress todruaga_readmem_cpu2[] =
  194. {
  195.     { 0xe000, 0xffff, MRA_ROM },                                 /* ROM code */
  196.     { 0x0040, 0x03ff, mappy_sharedram_r },                         /* shared RAM with the main CPU */
  197.  
  198.     { -1 }  /* end of table */
  199. };
  200.  
  201.  
  202. /* CPU 2 write addresses */
  203. static struct MemoryWriteAddress writemem_cpu2[] =
  204. {
  205.     { 0x0040, 0x03ff, mappy_sharedram_w },                       /* shared RAM with the main CPU */
  206.     { 0x0000, 0x003f, mappy_sound_w, &mappy_soundregs },         /* sound control registers */
  207.     { 0x2000, 0x2001, mappy_interrupt_enable_2_w },              /* interrupt enable */
  208.     { 0x2006, 0x2007, mappy_sound_enable_w },                    /* sound enable */
  209.     { 0xe000, 0xffff, MWA_ROM },                                 /* ROM code */
  210.  
  211.     { -1 }  /* end of table */
  212. };
  213.  
  214.  
  215. /* input from the outside world */
  216. INPUT_PORTS_START( mappy )
  217.     PORT_START      /* DSW0 */
  218. /* According to the manual, 0x04, 0x08 and 0x10 should always be off,
  219. but... */
  220.     PORT_DIPNAME( 0x07, 0x00, "Rank" )
  221.     PORT_DIPSETTING(    0x00, "A" )
  222.     PORT_DIPSETTING(    0x01, "B" )
  223.     PORT_DIPSETTING(    0x02, "C" )
  224.     PORT_DIPSETTING(    0x03, "D" )
  225.     PORT_DIPSETTING(    0x04, "E" )
  226.     PORT_DIPSETTING(    0x05, "F" )
  227.     PORT_DIPSETTING(    0x06, "G" )
  228.     PORT_DIPSETTING(    0x07, "H" )
  229.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
  230.     PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
  231.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  232.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_5C) )
  233.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_7C ) )
  234.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )
  235.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  236.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  237.     PORT_BITX(    0x40, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE )
  238.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  239.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  240.     PORT_DIPNAME( 0x80, 0x00, "Freeze" )
  241.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  242.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  243.  
  244.     PORT_START      /* DSW1 */
  245.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
  246.     PORT_DIPSETTING(    0x06, DEF_STR( 3C_1C ) )
  247.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  248.     PORT_DIPSETTING(    0x07, DEF_STR( 3C_2C ) )
  249.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  250.     PORT_DIPSETTING(    0x05, DEF_STR( 2C_3C ) )
  251.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  252.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  253.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) )
  254.     /* TODO: bonus scores are different for 5 lives */
  255.     PORT_DIPNAME( 0x38, 0x00, DEF_STR( Bonus_Life ) )
  256.     PORT_DIPSETTING(    0x28, "20k 70k and every 70k" )
  257.     PORT_DIPSETTING(    0x30, "20k 80k and every 80k" )
  258.     PORT_DIPSETTING(    0x08, "20k 60k" )
  259.     PORT_DIPSETTING(    0x00, "20k 70k" )
  260.     PORT_DIPSETTING(    0x10, "20k 80k" )
  261.     PORT_DIPSETTING(    0x18, "30k 100k" )
  262.     PORT_DIPSETTING(    0x20, "20k" )
  263.     PORT_DIPSETTING(    0x38, "None" )
  264. /* those are the bonus with 5 lives
  265.     PORT_DIPNAME( 0x38, 0x00, DEF_STR( Bonus_Life ) )
  266.     PORT_DIPSETTING(    0x28, "30k 100k and every 100k" )
  267.     PORT_DIPSETTING(    0x30, "40k 120k and every 120k" )
  268.     PORT_DIPSETTING(    0x00, "30k 80k" )
  269.     PORT_DIPSETTING(    0x08, "30k 100k" )
  270.     PORT_DIPSETTING(    0x10, "30k 120k" )
  271.     PORT_DIPSETTING(    0x18, "30k" )
  272.     PORT_DIPSETTING(    0x20, "40k" )
  273.     PORT_DIPSETTING(    0x38, "None" ) */
  274.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Lives ) )
  275.     PORT_DIPSETTING(    0x80, "1" )
  276.     PORT_DIPSETTING(    0xc0, "2" )
  277.     PORT_DIPSETTING(    0x00, "3" )
  278.     PORT_DIPSETTING(    0x40, "5" )
  279.  
  280.     PORT_START      /* DSW2 */
  281.     PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
  282.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  283.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  284.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  285.     PORT_SERVICE( 0x08, IP_ACTIVE_HIGH )
  286.     PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
  287.  
  288.     PORT_START      /* FAKE */
  289.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  290.     /* These fake input ports are read by mappy_customio_data_r() */
  291.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
  292.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  293.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
  294.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY )
  295.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1, 1 )
  296.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  297.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  298.  
  299.     PORT_START      /* FAKE */
  300.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  301. /* Coin 2 is not working */
  302.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  303.     PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
  304.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_START1, 1 )
  305.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_START2, 1 )
  306.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  307.  
  308.     PORT_START        /* FAKE */
  309.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  310.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
  311.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL, 1 )
  312.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  313.  
  314. INPUT_PORTS_END
  315.  
  316.  
  317. INPUT_PORTS_START( digdug2 )
  318.     PORT_START      /* DSW0 */
  319.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
  320.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  321.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  322.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
  323.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  324.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  325.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
  326.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  327.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  328.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  329.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  330.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  331.     PORT_DIPNAME( 0x10, 0x00, "Reset" )
  332.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  333.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  334.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Lives ) )
  335.     PORT_DIPSETTING(    0x00, "3" )
  336.     PORT_DIPSETTING(    0x20, "5" )
  337.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coinage ) )
  338.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  339.     PORT_DIPSETTING(    0xc0, "2 Coins/1 Credit 3C/2C" )
  340.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  341.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
  342.  
  343.     PORT_START      /* DSW1 */
  344.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Bonus_Life ) )
  345.     PORT_DIPSETTING(    0x00, "30k 80k and ..." )
  346.     PORT_DIPSETTING(    0x01, "30k 100k and ..." )
  347.     PORT_DIPSETTING(    0x02, "30k 120k and ..." )
  348.     PORT_DIPSETTING(    0x03, "30k 150k and..." )
  349.     PORT_DIPNAME( 0x04, 0x00, "Level Select" )
  350.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  351.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  352.     PORT_DIPNAME( 0x08, 0x00, "Freeze?" )
  353.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  354.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  355.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2, 1 )
  356.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON2, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  357.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  358.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  359.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  360. //    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
  361.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  362.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  363.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  364.  
  365.     PORT_START      /* DSW2 */
  366.     PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED )
  367.     PORT_SERVICE( 0x08, IP_ACTIVE_HIGH )
  368.     PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
  369.  
  370.     PORT_START      /* FAKE */
  371.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  372.     /* These fake input ports are read by mappy_customio_data_r() */
  373.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
  374.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  375.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  376.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  377.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1, 1 )
  378.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  379.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  380.  
  381.     PORT_START      /* FAKE */
  382.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  383. /* Coin 2 is not working */
  384.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  385.     PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
  386.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_START1, 1 )
  387.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_START2, 1 )
  388.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  389.  
  390.     PORT_START      /* FAKE */
  391.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  392.     /* These fake input ports are read by mappy_customio_data_r() */
  393.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  394.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  395.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  396.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  397.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL , 1 )
  398.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL , 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  399.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  400.  
  401. INPUT_PORTS_END
  402.  
  403.  
  404. INPUT_PORTS_START( motos )
  405.     PORT_START      /* DSW0 */
  406.     PORT_DIPNAME( 0x01, 0x00, "Reset" )
  407.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  408.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  409.     PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )
  410.     PORT_DIPSETTING(    0x06, DEF_STR( 3C_1C ) )
  411.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  412.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  413.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  414.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )
  415.     PORT_DIPSETTING(    0x00, "3" )
  416.     PORT_DIPSETTING(    0x08, "5" )
  417.     PORT_DIPNAME( 0x10, 0x00, "Rank" )
  418.     PORT_DIPSETTING(    0x00, "A" )
  419.     PORT_DIPSETTING(    0x10, "B" )
  420.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Bonus_Life ) )
  421.     PORT_DIPSETTING(    0x00, "10k 30k and every 50k" )
  422.     PORT_DIPSETTING(    0x20, "20k and every 50k" )
  423.     PORT_DIPSETTING(    0x40, "30k and every 70k" )
  424.     PORT_DIPSETTING(    0x60, "20k 70k" )
  425.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  426.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  427.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  428.  
  429.     PORT_START      /* DSW1 */
  430.     PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_UNUSED )
  431.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  432.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  433.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  434.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  435.  
  436.     PORT_START      /* FAKE */
  437.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  438.     /* These fake input ports are read by mappy_customio_data_r() */
  439.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
  440.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  441.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  442.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  443.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1, 2 )
  444.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  445.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  446.  
  447.     PORT_START      /* FAKE */
  448.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 2 )
  449.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 2 )
  450.     PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
  451.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_HIGH, IPT_START1, 2 )
  452.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_HIGH, IPT_START2, 2 )
  453.     PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNUSED )
  454.  
  455.     PORT_START      /* FAKE */
  456.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  457.     /* These fake input ports are read by mappy_customio_data_r() */
  458.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  459.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  460.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  461.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  462.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL , 2 )
  463.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL , 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  464.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  465.  
  466.  
  467. INPUT_PORTS_END
  468.  
  469.  
  470. INPUT_PORTS_START( todruaga )
  471.     PORT_START      /* DSW0 */
  472.     PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED )
  473.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )
  474.     PORT_DIPSETTING(    0x20, "1" )
  475.     PORT_DIPSETTING(    0x10, "2" )
  476.     PORT_DIPSETTING(    0x00, "3" )
  477.     PORT_DIPSETTING(    0x30, "5" )
  478.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_A ) )
  479.     PORT_DIPSETTING(    0xc0, DEF_STR( 3C_1C ) )
  480.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  481.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  482.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
  483.  
  484.     PORT_START      /* DSW1 */
  485.     PORT_DIPNAME( 0x01, 0x00, "Freeze" )
  486.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  487.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  488.     PORT_DIPNAME( 0x02, 0x00, "Reset" )
  489.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  490.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  491.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_B ) )
  492.     PORT_DIPSETTING(    0x0c, DEF_STR( 3C_1C ) )
  493.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  494.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  495.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  496.     PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_UNUSED )
  497.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  498.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  499.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  500.  
  501.     PORT_START      /* DSW2 */
  502.     PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED )
  503.     PORT_SERVICE( 0x08, IP_ACTIVE_HIGH )
  504.     PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
  505.  
  506.     PORT_START      /* FAKE */
  507.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  508.     /* These fake input ports are read by mappy_customio_data_r() */
  509.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
  510.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  511.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  512.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  513.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1, 1 )
  514.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  515.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
  516.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1 )    /* used on level 31 */
  517.  
  518.     PORT_START      /* FAKE */
  519.     PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED )
  520.     /* this is just a guess */
  521.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2, 1 )
  522.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON2, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  523.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  524.  
  525.     PORT_START      /* FAKE */
  526.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  527. /* Coin 2 is not working */
  528.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  529.     PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
  530.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )    /* we take it from port 3 */
  531. //    PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_START1, 1 )
  532.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_START2, 1 )
  533.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  534.  
  535.     PORT_START      /* FAKE */
  536.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  537.     /* These fake input ports are read by mappy_customio_data_r() */
  538.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  539.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  540.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  541.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  542.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL , 1 )
  543.     PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL , 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  544.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
  545.  
  546.  
  547. INPUT_PORTS_END
  548.  
  549.  
  550. /* layout of the 8x8x2 character data */
  551. static struct GfxLayout charlayout =
  552. {
  553.     8,8,             /* 8*8 characters */
  554.     256,             /* 256 characters */
  555.     2,             /* 2 bits per pixel */
  556.     { 0, 4 },      /* the two bitplanes for 4 pixels are packed into one byte */
  557.     { 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },   /* bits are packed in groups of four */
  558.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },   /* characters are rotated 90 degrees */
  559.     16*8           /* every char takes 16 bytes */
  560. };
  561.  
  562.  
  563. /* layout of the 16x16x4 sprite data */
  564. static struct GfxLayout mappy_spritelayout =
  565. {
  566.     16,16,       /* 16*16 sprites */
  567.     128,            /* 128 sprites */
  568.     4,                 /* 4 bits per pixel */
  569.     { 0, 4, 8192*8, 8192*8+4 },     /* the two bitplanes for 4 pixels are packed into one byte */
  570.     { 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,
  571.             24*8+0, 24*8+1, 24*8+2, 24*8+3 },
  572.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  573.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  574.     64*8    /* every sprite takes 64 bytes */
  575. };
  576.  
  577.  
  578. static struct GfxLayout digdug2_spritelayout =
  579. {
  580.     16,16,       /* 16*16 sprites */
  581.     256,            /* 256 sprites */
  582.     4,                 /* 4 bits per pixel */
  583.     { 0, 4, 16384*8, 16384*8+4 },   /* the two bitplanes for 4 pixels are packed into one byte */
  584.     { 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,
  585.             24*8+0, 24*8+1, 24*8+2, 24*8+3 },
  586.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  587.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  588.     64*8    /* every sprite takes 64 bytes */
  589. };
  590.  
  591.  
  592. /* pointers to the appropriate memory locations and their associated decode structs */
  593. static struct GfxDecodeInfo mappy_gfxdecodeinfo[] =
  594. {
  595.     { REGION_GFX1, 0, &charlayout,            0, 64 },
  596.     { REGION_GFX2, 0, &mappy_spritelayout, 64*4, 16 },
  597.     { -1 } /* end of array */
  598. };
  599.  
  600. static struct GfxDecodeInfo digdug2_gfxdecodeinfo[] =
  601. {
  602.     { REGION_GFX1, 0, &charlayout,              0, 64 },
  603.     { REGION_GFX2, 0, &digdug2_spritelayout, 64*4, 16 },
  604.     { -1 } /* end of array */
  605. };
  606.  
  607. static struct GfxDecodeInfo todruaga_gfxdecodeinfo[] =
  608. {
  609.     { REGION_GFX1, 0, &charlayout,            0, 64 },
  610.     { REGION_GFX2, 0, &mappy_spritelayout, 64*4, 64 },
  611.     { -1 } /* end of array */
  612. };
  613.  
  614. static struct namco_interface namco_interface =
  615. {
  616.     23920,    /* sample rate (approximate value) */
  617.     8,        /* number of voices */
  618.     100,    /* playback volume */
  619.     REGION_SOUND1    /* memory region */
  620. };
  621.  
  622.  
  623.  
  624. /* the machine driver: 2 6809s running at 1MHz */
  625. static struct MachineDriver machine_driver_mappy =
  626. {
  627.     /* basic machine hardware */
  628.     {
  629.         {
  630.             CPU_M6809,
  631.             1100000,                        /* 1.1 Mhz */
  632.             mappy_readmem_cpu1,writemem_cpu1,0,0,
  633.             mappy_interrupt_1,1
  634.         },
  635.         {
  636.             CPU_M6809,
  637.             1100000,                        /* 1.1 Mhz */
  638.             mappy_readmem_cpu2,writemem_cpu2,0,0,
  639.             mappy_interrupt_2,1
  640.         }
  641.     },
  642.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  643.     100,    /* 100 CPU slices per frame - an high value to ensure proper */
  644.             /* synchronization of the CPUs */
  645.     mappy_init_machine,
  646.  
  647.     /* video hardware */
  648.     36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },
  649.     mappy_gfxdecodeinfo,
  650.     32,64*4+16*16,
  651.     mappy_vh_convert_color_prom,
  652.  
  653.     VIDEO_TYPE_RASTER,
  654.     0,
  655.     mappy_vh_start,
  656.     mappy_vh_stop,
  657.     mappy_vh_screenrefresh,
  658.  
  659.     /* sound hardware */
  660.     0,0,0,0,
  661.     {
  662.         {
  663.             SOUND_NAMCO,
  664.             &namco_interface
  665.         }
  666.     }
  667. };
  668.  
  669. static struct MachineDriver machine_driver_digdug2 =
  670. {
  671.     /* basic machine hardware */
  672.     {
  673.         {
  674.             CPU_M6809,
  675.             1600000,                        /* 1.6 Mhz */
  676.             digdug2_readmem_cpu1,writemem_cpu1,0,0,
  677.             mappy_interrupt_1,1
  678.         },
  679.         {
  680.             CPU_M6809,
  681.             1600000,                        /* 1.6 Mhz */
  682.             digdug2_readmem_cpu2,writemem_cpu2,0,0,
  683.             mappy_interrupt_2,1
  684.         }
  685.     },
  686.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  687.     100,    /* 100 CPU slices per frame - an high value to ensure proper */
  688.             /* synchronization of the CPUs */
  689.     mappy_init_machine,
  690.  
  691.     /* video hardware */
  692.     36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },
  693.     digdug2_gfxdecodeinfo,
  694.     32,64*4+16*16,
  695.     mappy_vh_convert_color_prom,
  696.  
  697.     VIDEO_TYPE_RASTER,
  698.     0,
  699.     mappy_vh_start,
  700.     mappy_vh_stop,
  701.     mappy_vh_screenrefresh,
  702.  
  703.     /* sound hardware */
  704.     0,0,0,0,
  705.     {
  706.         {
  707.             SOUND_NAMCO,
  708.             &namco_interface
  709.         }
  710.     }
  711. };
  712.  
  713. static struct MachineDriver machine_driver_motos =
  714. {
  715.     /* basic machine hardware */
  716.     {
  717.         {
  718.             CPU_M6809,
  719.             1600000,                        /* 1.6 Mhz */
  720.             motos_readmem_cpu1,writemem_cpu1,0,0,
  721.             mappy_interrupt_1,1
  722.         },
  723.         {
  724.             CPU_M6809,
  725.             1600000,                        /* 1.6 Mhz */
  726.             motos_readmem_cpu2,writemem_cpu2,0,0,
  727.             mappy_interrupt_2,1
  728.         }
  729.     },
  730.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  731.     100,    /* 100 CPU slices per frame - an high value to ensure proper */
  732.             /* synchronization of the CPUs */
  733.     motos_init_machine,
  734.  
  735.     /* video hardware */
  736.     36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },
  737.     digdug2_gfxdecodeinfo,
  738.     32,64*4+16*16,
  739.     mappy_vh_convert_color_prom,
  740.  
  741.     VIDEO_TYPE_RASTER,
  742.     0,
  743.     motos_vh_start,
  744.     mappy_vh_stop,
  745.     mappy_vh_screenrefresh,
  746.  
  747.     /* sound hardware */
  748.     0,0,0,0,
  749.     {
  750.         {
  751.             SOUND_NAMCO,
  752.             &namco_interface
  753.         }
  754.     }
  755. };
  756.  
  757. static struct MachineDriver machine_driver_todruaga =
  758. {
  759.     /* basic machine hardware */
  760.     {
  761.         {
  762.             CPU_M6809,
  763.             1600000,                        /* 1.6 Mhz */
  764.             todruaga_readmem_cpu1,writemem_cpu1,0,0,
  765.             mappy_interrupt_1,1
  766.         },
  767.         {
  768.             CPU_M6809,
  769.             1600000,                        /* 1.6 Mhz */
  770.             todruaga_readmem_cpu2,writemem_cpu2,0,0,
  771.             mappy_interrupt_2,1
  772.         }
  773.     },
  774.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  775.     100,    /* 100 CPU slices per frame - an high value to ensure proper */
  776.             /* synchronization of the CPUs */
  777.     mappy_init_machine,
  778.  
  779.     /* video hardware */
  780.     36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },
  781.     todruaga_gfxdecodeinfo,
  782.     32,64*4+64*16,
  783.     mappy_vh_convert_color_prom,
  784.  
  785.     VIDEO_TYPE_RASTER,
  786.     0,
  787.     todruaga_vh_start,
  788.     mappy_vh_stop,
  789.     mappy_vh_screenrefresh,
  790.  
  791.     /* sound hardware */
  792.     0,0,0,0,
  793.     {
  794.         {
  795.             SOUND_NAMCO,
  796.             &namco_interface
  797.         }
  798.     }
  799. };
  800.  
  801.  
  802.  
  803. ROM_START( mappy )
  804.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  805.     ROM_LOAD( "mappy1d.64",   0xa000, 0x2000, 0x52e6c708 )
  806.     ROM_LOAD( "mappy1c.64",   0xc000, 0x2000, 0xa958a61c )
  807.     ROM_LOAD( "mappy1b.64",   0xe000, 0x2000, 0x203766d4 )
  808.  
  809.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  810.     ROM_LOAD( "mappy1k.64",   0xe000, 0x2000, 0x8182dd5b )
  811.  
  812.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  813.     ROM_LOAD( "mappy3b.32",   0x0000, 0x1000, 0x16498b9f )
  814.  
  815.     ROM_REGION( 0x4000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  816.     ROM_LOAD( "mappy3m.64",   0x0000, 0x2000, 0xf2d9647a )
  817.     ROM_LOAD( "mappy3n.64",   0x2000, 0x2000, 0x757cf2b6 )
  818.  
  819.     ROM_REGION( 0x0220, REGION_PROMS )
  820.     ROM_LOAD( "mappy.pr1",    0x0000, 0x0020, 0x56531268 ) /* palette */
  821.     ROM_LOAD( "mappy.pr2",    0x0020, 0x0100, 0x50765082 ) /* characters */
  822.     ROM_LOAD( "mappy.pr3",    0x0120, 0x0100, 0x5396bd78 ) /* sprites */
  823.  
  824.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  825.     ROM_LOAD( "mappy.spr",    0x0000, 0x0100, 0x16a9166a )
  826. ROM_END
  827.  
  828. ROM_START( mappyjp )
  829.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  830.     ROM_LOAD( "mappy3.bin",   0xa000, 0x2000, 0xdb9d5ab5 )
  831.     ROM_LOAD( "mappy1c.64",   0xc000, 0x2000, 0xa958a61c )
  832.     ROM_LOAD( "mappy1.bin",   0xe000, 0x2000, 0x77c0b492 )
  833.  
  834.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  835.     ROM_LOAD( "mappy1k.64",   0xe000, 0x2000, 0x8182dd5b )
  836.  
  837.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  838.     ROM_LOAD( "mappy3b.32",   0x0000, 0x1000, 0x16498b9f )
  839.  
  840.     ROM_REGION( 0x4000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  841.     ROM_LOAD( "mappy3m.64",   0x0000, 0x2000, 0xf2d9647a )
  842.     ROM_LOAD( "mappy3n.64",   0x2000, 0x2000, 0x757cf2b6 )
  843.  
  844.     ROM_REGION( 0x0220, REGION_PROMS )
  845.     ROM_LOAD( "mappy.pr1",    0x0000, 0x0020, 0x56531268 ) /* palette */
  846.     ROM_LOAD( "mappy.pr2",    0x0020, 0x0100, 0x50765082 ) /* characters */
  847.     ROM_LOAD( "mappy.pr3",    0x0120, 0x0100, 0x5396bd78 ) /* sprites */
  848.  
  849.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  850.     ROM_LOAD( "mappy.spr",    0x0000, 0x0100, 0x16a9166a )
  851. ROM_END
  852.  
  853. ROM_START( digdug2 )
  854.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  855.     ROM_LOAD( "ddug2-3.bin",  0x8000, 0x4000, 0xbe7ec80b )
  856.     ROM_LOAD( "ddug2-1.bin",  0xc000, 0x4000, 0x5c77c0d4 )
  857.  
  858.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  859.     ROM_LOAD( "ddug2-4.bin",  0xe000, 0x2000, 0x737443b1 )
  860.  
  861.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  862.     ROM_LOAD( "ddug2-3b.bin", 0x0000, 0x1000, 0xafcb4509 )
  863.  
  864.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  865.     ROM_LOAD( "ddug2-3m.bin", 0x0000, 0x4000, 0xdf1f4ad8 )
  866.     ROM_LOAD( "ddug2-3n.bin", 0x4000, 0x4000, 0xccadb3ea )
  867.  
  868.     ROM_REGION( 0x0220, REGION_PROMS )
  869.     ROM_LOAD( "ddclr-5b.bin", 0x0000, 0x0020, 0x9b169db5 ) /* palette */
  870.     ROM_LOAD( "ddclr-4c.bin", 0x0020, 0x0100, 0x55a88695 ) /* characters */
  871.     ROM_LOAD( "ddclr-5k.bin", 0x0120, 0x0100, 0x1525a4d1 ) /* sprites */
  872.  
  873.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  874.     ROM_LOAD( "ddsnd.bin",    0x0000, 0x0100, 0xe0074ee2 )
  875. ROM_END
  876.  
  877. ROM_START( digdug2a )
  878.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  879.     ROM_LOAD( "ddug2a_3.bin",  0x8000, 0x4000, 0xcc155338 )
  880.     ROM_LOAD( "ddug2a_1.bin",  0xc000, 0x4000, 0x40e46af8 )
  881.  
  882.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  883.     ROM_LOAD( "ddug2-4.bin",  0xe000, 0x2000, 0x737443b1 )
  884.  
  885.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  886.     ROM_LOAD( "ddug2-3b.bin", 0x0000, 0x1000, 0xafcb4509 )
  887.  
  888.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  889.     ROM_LOAD( "ddug2-3m.bin", 0x0000, 0x4000, 0xdf1f4ad8 )
  890.     ROM_LOAD( "ddug2-3n.bin", 0x4000, 0x4000, 0xccadb3ea )
  891.  
  892.     ROM_REGION( 0x0220, REGION_PROMS )
  893.     ROM_LOAD( "ddclr-5b.bin", 0x0000, 0x0020, 0x9b169db5 ) /* palette */
  894.     ROM_LOAD( "ddclr-4c.bin", 0x0020, 0x0100, 0x55a88695 ) /* characters */
  895.     ROM_LOAD( "ddclr_5k.bin", 0x0120, 0x0100, 0x9c55feda ) /* sprites */
  896.     /* Can't see the difference on screen, but CRC differs. */
  897.  
  898.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  899.     ROM_LOAD( "ddsnd.bin",    0x0000, 0x0100, 0xe0074ee2 )
  900. ROM_END
  901.  
  902. ROM_START( motos )
  903.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  904.     ROM_LOAD( "mts_1d.bin",   0x8000, 0x4000, 0x1104abb2 )
  905.     ROM_LOAD( "mts_1b.bin",   0xc000, 0x4000, 0x57b157e2 )
  906.  
  907.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  908.     ROM_LOAD( "mts_1k.bin",   0xe000, 0x2000, 0x55e45d21 )
  909.  
  910.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  911.     ROM_LOAD( "mts_3b.bin",   0x0000, 0x1000, 0x5d4a2a22 )
  912.  
  913.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  914.     ROM_LOAD( "mts_3m.bin",   0x0000, 0x4000, 0x2f0e396e )
  915.     ROM_LOAD( "mts_3n.bin",   0x4000, 0x4000, 0xcf8a3b86 )
  916.  
  917.     ROM_REGION( 0x0220, REGION_PROMS )
  918.     ROM_LOAD( "motos.pr1",    0x0000, 0x0020, 0x71972383 ) /* palette */
  919.     ROM_LOAD( "motos.pr2",    0x0020, 0x0100, 0x730ba7fb ) /* characters */
  920.     ROM_LOAD( "motos.pr3",    0x0120, 0x0100, 0x7721275d ) /* sprites */
  921.  
  922.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  923.     ROM_LOAD( "motos.spr",    0x0000, 0x0100, 0x2accdfb4 )
  924. ROM_END
  925.  
  926. ROM_START( todruaga )
  927.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  928.     ROM_LOAD( "druaga3.bin",  0x8000, 0x4000, 0x7ab4f5b2 )
  929.     ROM_LOAD( "druaga1.bin",  0xc000, 0x4000, 0x8c20ef10 )
  930.  
  931.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  932.     ROM_LOAD( "druaga4.bin",  0xe000, 0x2000, 0xae9d06d9 )
  933.  
  934.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  935.     ROM_LOAD( "druaga3b.bin", 0x0000, 0x1000, 0xd32b249f )
  936.  
  937.     ROM_REGION( 0x4000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  938.     ROM_LOAD( "druaga3m.bin", 0x0000, 0x2000, 0xe827e787 )
  939.     ROM_LOAD( "druaga3n.bin", 0x2000, 0x2000, 0x962bd060 )
  940.  
  941.     ROM_REGION( 0x0520, REGION_PROMS )
  942.     ROM_LOAD( "todruaga.pr1", 0x0000, 0x0020, 0x122cc395 ) /* palette */
  943.     ROM_LOAD( "todruaga.pr2", 0x0020, 0x0100, 0x8c661d6a ) /* characters */
  944.     ROM_LOAD( "todruaga.pr3", 0x0120, 0x0100, 0x5bcec186 ) /* sprites */
  945.     ROM_LOAD( "todruaga.pr4", 0x0220, 0x0100, 0xf029e5f5 ) /* sprites */
  946.     ROM_LOAD( "todruaga.pr5", 0x0320, 0x0100, 0xecdc206c ) /* sprites */
  947.     ROM_LOAD( "todruaga.pr6", 0x0420, 0x0100, 0x57b5ad6d ) /* sprites */
  948.  
  949.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  950.     ROM_LOAD( "todruaga.spr", 0x0000, 0x0100, 0x07104c40 )
  951. ROM_END
  952.  
  953. ROM_START( todruagb )
  954.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  955.     ROM_LOAD( "druaga3a.bin", 0x8000, 0x4000, 0xfbf16299 )
  956.     ROM_LOAD( "druaga1a.bin", 0xc000, 0x4000, 0xb238d723 )
  957.  
  958.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  959.     ROM_LOAD( "druaga4.bin",  0xe000, 0x2000, 0xae9d06d9 )
  960.  
  961.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  962.     ROM_LOAD( "druaga3b.bin", 0x0000, 0x1000, 0xd32b249f )
  963.  
  964.     ROM_REGION( 0x4000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  965.     ROM_LOAD( "druaga3m.bin", 0x0000, 0x2000, 0xe827e787 )
  966.     ROM_LOAD( "druaga3n.bin", 0x2000, 0x2000, 0x962bd060 )
  967.  
  968.     ROM_REGION( 0x0520, REGION_PROMS )
  969.     ROM_LOAD( "todruaga.pr1", 0x0000, 0x0020, 0x122cc395 ) /* palette */
  970.     ROM_LOAD( "todruaga.pr2", 0x0020, 0x0100, 0x8c661d6a ) /* characters */
  971.     ROM_LOAD( "todruaga.pr3", 0x0120, 0x0100, 0x5bcec186 ) /* sprites */
  972.     ROM_LOAD( "todruaga.pr4", 0x0220, 0x0100, 0xf029e5f5 ) /* sprites */
  973.     ROM_LOAD( "todruaga.pr5", 0x0320, 0x0100, 0xecdc206c ) /* sprites */
  974.     ROM_LOAD( "todruaga.pr6", 0x0420, 0x0100, 0x57b5ad6d ) /* sprites */
  975.  
  976.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  977.     ROM_LOAD( "todruaga.spr", 0x0000, 0x0100, 0x07104c40 )
  978. ROM_END
  979.  
  980.  
  981.  
  982. GAME( 1983, mappy,    0,        mappy,    mappy,    0, ROT90, "Namco", "Mappy (US)" )
  983. GAME( 1983, mappyjp,  mappy,    mappy,    mappy,    0, ROT90, "Namco", "Mappy (Japan)" )
  984. GAME( 1985, digdug2,  0,        digdug2,  digdug2,  0, ROT90, "Namco", "Dig Dug II (set 1)" )
  985. GAME( 1985, digdug2a, digdug2,  digdug2,  digdug2,  0, ROT90, "Namco", "Dig Dug II (set 2)" )
  986. GAME( 1985, motos,    0,        motos,    motos,    0, ROT90, "Namco", "Motos" )
  987. GAME( 1984, todruaga, 0,        todruaga, todruaga, 0, ROT90, "Namco", "Tower of Druaga (set 1)" )
  988. GAME( 1984, todruagb, todruaga, todruaga, todruaga, 0, ROT90, "Namco", "Tower of Druaga (set 2)" )
  989.